package simulation;

import common.IGrid;
import common.StepData;

/**
 * @author cwhalen
 * 
 */
public class SimEngine {
  private Sun sModel;
  private Earth eModel;

  /**
   * @param gridSpacing
   * @param radius
   */
  public SimEngine(int gridSpacing, int radius) {
    super();
    this.sModel = new Sun(0);
    this.eModel = new Earth(gridSpacing, radius, sModel);
  }
  
  /**
   * @return
   */
  public Earth getEModel() {
    return eModel;
  }

  public void setGridSpacing(int gridSpacing, int newRadius) {
    eModel.setGridSpacing(gridSpacing, newRadius);
  }

  public void step() {
    eModel.step();
  }
  
  public IGrid getGrid() {
    return eModel;
  }
  
  public StepData getStepData() {
    return new StepData(eModel, eModel.getSunDegStep(), eModel.getSimTimeStep());
  }
  
  public void setSimTimeStep(int minutes) {
    eModel.setSimTimeStep(minutes);
  }
  
  public void reset() {
    eModel.reset();
  }
  
  public static void main(String[] args) {
    //for testing
    SimEngine e = new SimEngine(15, 200);
    
    e.setSimTimeStep(60);
    
    for(int i = 0; i <10; i ++)
    {
	    System.out.println(e.sModel.getLongitude());
	    e.getEModel().print();
	    e.step();
	    System.out.print("\n");
    }
  }
}
